
jQuery

2



3


Web
Java Script
WebServer


AJAX
Web
Java Script
Java Script
Java Script
jQuery
jQueryJava Script
Web 
John Resig

Java script
jQuery
GoogleMozillaWordPressDrupalDELL
Microsoft
4
     ASP.NET 4 
Visual Studio 2010
Java Script
jQueryjQueryWeb 2
jQuery
IE6Firefox 2
Safari 3Opera 9Google chrome



HTML CSSJava script










5

jQuery
6
Queryj
jQuery
comjquerywww
Download


jsjquery
    
  
jquery-min.js



Web
<head><head/>
<script srcjQueryjs” type”textjavascript”>
<script>
java script

src
  jQuery.js      
7
jQuery.jsWeb


Queryj
jQuery
SelectorsFunctionsEvents
AnimationsPlugins

Java ScriptjQuery

Web
jQuery
Web



jQuery

Google
8
Google


9
Links
Fade in
jQuery
Fade inLinks



$(„a‟).fadeIn();

Microsoft

10
Flash
menustabsSlider
jQuery
Silverlight


GoogleMicrosoft

jQuery


Queryj

Java scriptjQuery

<html>
<head>
<scriptsrcjQueryjs type”textjavascript>
11
<script>
<scripttypetextjavascript>
$(document).ready(function(){
 
});
<script>
<head>
<body>

<body>
<html>
HTML

$(document).ready(function(){

});


jQuery
12
jQuery

jQuery



jQueryDOMData Object
Model
Dial up
DOM
DOM
jQuery

jQuery
jQuery

13


Selectors
14

Cascading Style Sheets
CSS
Web
p
p{fontsizemedium; }

a{ colorred;}

p,a{ fontfamilyTahoma,Arial; }
Mukhtar

Mukhtar img{ borderwidthmedium; }
ap
p,a.Mukhtar img   CSS  
SelectorsjQuerySelectors
WebHTML
jQuery
15

CSSjQuery
3CSSCSS 3

jQueryjQuery

jquery(„selector‟);

$(„selector‟);
Selector

 $ jquery       
jquery(selector)$(selector)   
PHP


aa

$(„a‟);

16
jquery(„a‟);
img

$(„img‟);

jquery(„img‟);
aimg

           
td:has(img)
$(„td:has(img)‟);

jquery(„td:has(img)‟);

jQuery      

<html>
<head>
<scriptsrc”jQueryjs” type”textjavascript”>
<script>
17
<scripttype”textjavascript”>
$(document).ready(function(){
$(„a‟);
$(„img‟);
$(„td:has(img)‟);
});
<script>
<head>
<body>

<body>
<html>
jQuery






18
$jquery
 selector     
array<element>Java Script
jQuery Wrapped Set
jQuery


$(„selector‟).function();
function
jQuery
jQuery Wrapped Set      selector

$(„selector‟).hide();
selector$
hide



$‟selector‟.function1().function2();
19
function1
selectorfunction2
function1
function1function2
   selector

$(selector).Q1().Q2().Q3(). .Qn();
n

jQuery

$(„a‟).fadeOut().addClass(„red‟);

afadeOut
CSS Classred
class=”red”
jQuery
jQuery
<html>
<head>
<title></title>
20
<script src="jquery.js" type="text/javascript">
</script>
<script type="text/javascript">
$(document).ready(function() {
$(„#Button1‟).click(function() {
$(‘#TextArea1’).toggle(‘slow’);
})
});
</script>
</head>
<body>
<input id="Button1" type="button" value="
" />
<textarea id="TextArea1" name="S1"></textarea>
</body>
</html>

jQuery

$('#TextArea1').toggle('slow');
21
TextArea1
toggle
TextArea1#TextArea1
SetWrappedjQuery
Web
jQuery
$jqueryjQuery
Wrapped SetjQuery

         


Selector
Description

T
Tp
pa
aimgimg

C
C
22
“C”class
C1 C2 C3 Cn
    
C1
C2
C3
Cn

#X
X
“X”id
T F
   F  
T
T>F
   F  
T
   div>a   
 div   
div       


div a
div
TF
FT
     

23
ThasF
T
    F
Table:has(a)    

TA
TA 
A
a[href]     
href
TAvalue
TA
value
a[target=_blank]

TA^value
TA

value
   de
a[href^=www.de]
TA$value
TA

valuea[href$=.mp3]

24
mp3
TAvalue
TA

valuea[href*=great]
     
great
selectorfirst
    selector
  a:first
       
div img:first 
div
selectorlast
    selector

selectorfirstchild
selector
     
div a:first-child
div

first
selectorlastchild
selector
25

selectoronlychild
selector
         
   div  
div
div a:only-child
selectornthchildn
   n 
selector     
   div  
div a:nth-child(4)
selectornth
childeven
     
selector
selectornth
childodd
     
selector
selectornthchildXn
X
X
div a:nth-child(3n)
div


26

selectornth
childXnY
YX
YX
div a:nth-child(3n+2)
div




selectoreven
    
selector
selectorodd
     
selector
selectoreqn
   n 
selector
selectorqtn
   n
selector

selectorltn
   n 
selector
27

animated


button

  submit  reset 
button
checkbox
check boxes
checked
     
 checked 
check boxradio button
containss
s
p:contains(jQuery) 
    jQuery
     
YesyEsYES
disabled

enabled

file

input[type=”file”]
28
header
    
h1,h2,h3,h4,h5,h6
hidden

image

input[type=image]
input
input select
textareabutton
notselector
     
selector 
:input:not(:button) 

parent


password

input[type=password]
radio
radio button
reset

selected
selected
options
29
submit

text
    
input[type=text]
visible

Selector1,Selector2,
…,Selectorn
     


       

jQuery
          
          
jQuery
www.jquery.com
30
HTML
WebRich Internet Applications
HTML
commultiuploadwww
     
    
one more
file
    
    



  

one more file



Server
HTMLjQuery
31
HTML

$HTML
HTMLHTML
        
„<div>‟$div„<div><div/>$



script
jQuery


$(„<div>  <div>‟).append(„#id‟);

idappend

32
3257

Functions
33
Functions


jQueryjQuery Wrapped Set


Attributes

<img src”imagespic1gif” alt”imageOne” title”image
one” width”40” height”20”>
Attributesheight
widthtitlealtsrc
Webnode
Properties




34
jQuery
attr

$(„#id‟).attr(„attributeName‟);
attributeNameid
attr
$(„#id‟).attr(„attributeName‟ , „value);
attributeNameid
value
#id




             

$(„selector‟).each(function(n){
$(this).attr(„attributeName);
)};
35

$(„selector‟).each(function(n){
$(this).attr(attributeName , value);
)};
this
each
each


$(selector).attr(JSON);
JSONJSON


$(input).attr(
{ value„‟ , title‟ }
);
„‟value



title
36

removeAttr

$#idremoveAttrattributeName;
 attributeName       
removeAttr
$aremoveAttrtarget;
target
JSONJava Script Object Notation


{
Key1value1,
Key2„value2,
,
Keyn„valuen
}
key1
value1
key2

value2
keyn
valuen

37
Styles
jQuery
CSS Class
addClass
$selectoraddClassclassName;
className
selector

space

<span class”class1 class2 class3 class4 … classn> <span>
span
addClass

jQuery
removeClass
$(selector).removeClass(className);
38
className
selector
      jQuery   
toggleClass


$selectortoggleClassclassName;


<html>
<head>
<title>  <title>
<styletypetextcss>
.black {
backgroundcolorblack;
 colorWhite;
}
<style>
<head>
<body>
39
<table id”table1”>
<tr>
<td><td>
<td><td>
<tr>
<tr>
<td> <td>
<td> <td>
<tr>
<tr>
<td> <td>
<td> <td>
<tr>
<tr>
<td> <td>
<td> <td>
<tr>
<tr>
<td> <td>
40
<td> <td>
<tr>
<table>
<body>
<html>


InternetWeb
Zebra
stripping
41
Web

<tableid”table1”>
<tr>
<td><td>
<td><td>
<tr>
<tr class”black”>
<td> <td>
<td> <td>
<tr>
<tr>
<td> <td>
<td> <td>
<tr>
<tr class”black”>
<td> <td>
<td> <td>
42
 <tr>
<tr>
<td> <td>
<td> <td>
<tr>
<table>



jQuery
$#table1 tr‟toggleClass‟black‟;


$‟#table1 treven‟addClass‟black‟;
43
Classes

css

$‟#id‟css‟name‟;
name
id
$‟#id‟css‟name‟,‟value‟;
valuename
idattr
eacheach

$‟#id‟cssJSON;
JSON
selector
width

$‟#id‟width;

44
$‟#id‟widthvalue;
height
$‟#id‟height;

$‟#id‟heightvalue;
Inner content
jQueryWeb
html

$(‟#id‟).html();
HTMLid

$(‟#id‟).html(Con);
ConHTML
text
HTML
$‟#id‟text;
45

$‟#id‟textCon;
Con
htmltext
<ul id”myul”>
<li>1<li>
<li>2<li>
<ul>
text
$(„#myul‟).text();
12Stringhtml

<li>1<li>
<li>2<li>

append
HTML
$‟selector‟appendHTML;
46




$‟targetSelector‟append($(‟sourceSelector‟));
            
sourceSelectorHTML

sourceSelector
          
targetSelector



<ul>
<li>11<li>
<li id”item12”>12<li>
<ul>
<ol>
<li>21<li>
<ol>
47

$item12‟append$‟ol‟;


$‟ul li‟append$‟ol‟;



append

    append appendTo 

$‟source‟appendTo‟target‟;
source
target

$‟#copyrightLabel‟appendTocode‟;
48
copyrightLabel
codecode
copyrightLabel
append
appendTo
appendappendTo

prependprependTo

prependappendprependToappendTo
before()insertBefore()




          after()
insertAfter()
49
append


$p imgbefore<p>I love Syria<p>;
I love Syriap img

$‟<p>I love Syria<p>‟insertBefore‟p img‟;

$‟ahref^http://wwwafter‟<small style ”colorred”>
external<small>‟;
external

$<small style”colorred”> external
<small>insertAfterahref^http://www;




html
Parameter
50

HTML

text
html

String
append
       



appendTo
       


prepend
       

prependTo
       


before


51
insertBefore


after


insertAfter


Wrapping

imgaimga
p adiv

52
jQuerywrap
           
parameter
$‟selector‟wrapWrapper;
selectorWrapper
jQuery
$‟img‟wrap‟<a href”#”><a>‟;


wrapAll

$‟selector‟wrapAll‟Wrapper‟;
Wrap
<html>
<head>
<script src="jquery.js" type="text/javascript">
</script>
<script type="text/javascript">
$(document).ready(function() {
$('img[src]').wrap('<a href="#"></a>');
53
});
</script>
</head>
<body>
<img src="noPic.gif" alt="no Pic!" />
</body>
</html>



wrapInner
$‟selector‟wrapInner‟Wrapper‟;


54

jQueryremove

$(‟selector‟).remove();
selector
inner content
empty
$(‟selector‟).empty();
clone
beforeafterappend
divdiv
$(„#sourceDiv‟).clone().appendTo(„#targetDiv‟);
FORM ELEMENTS
FormsWeb
Web

W3Cjava script
jQuery
55

val
$(‟selector‟).val();
selector
selector
val
value
val
Multi-select elementval


$(‟#firstName‟).val();
valuefirstName
val

selectorWeb
valvalue
check boxradio button       
56
selected

$(nameradioGroupselected‟).val();
val

$(‟selector‟).val(value);
valradio buttonscheck
boxes<select>selected
$(‟selector‟).val(values);
selector
values
selected
$‟input‟val([abokamal‟,‟jQuery‟,‟Mukhtar‟]);
selectedvalue
abokamaljQueryMukhtar

<html>
57
<head>
<script src="jquery.js" type="text/javascript">
</script>
<script type="text/javascript">
$(document).ready(function() {
$('*').val(['abokamal', 'jQuery']);
});
</script>
</head>
<body>
<select id="Select1">
<option value="X">Abokamal</option>
<option value="jQuery">jQuery</option>
<option>Mukhtar</option>
</select>
</body>
</html>
val
pluginForm Plugin

58


Events
59
Events
jQuery

Event
Web




ClickDouble click
Mouse move



Event
handling
Web
function


60
Web
Browsers
Web
Java ScriptjQuery


HTMLXHTML
Click
Link



onClick
onclickmouse Move
onmousemove       focus  
onfocus
jQuery
<html>
<head>
<scripttypetextjavascript>
function myClickHandler(){
alert(“”);
61
};
function myMoveHandler(){
alert(“”);
};
<script>
<head>
<body>
<inputidButton1typebuttonvalue
onclickmyClickHandler() >
<imgsrcmyPicgif onmousemovemyMoveHandler() >
<body>
<html>
onclick
java script
myClickHandler
onmousemove


62

jQuery
jQuery
 jQuery 

on
     click click
onclick        
mousemoveonmousemove

<html>
<head>
<scripttype”textjavascript” src”jqueryjs”>
</script>
<scripttype”textjavascript”>
$(document).ready(function(){
$(„#Button1‟).click(function(){
alert;
});
$(„img‟).mousemove(function(){
alert;
63
});
});
<script>
<head>
<body>
<inputid”Button1” type”button” value>
<imgsrc”myPicgif” >
<body>
<html>
jQuery





jQuery


64



load

unload



    lose
focusfocus




focus   

Tab
    
     
<select>
65

textarea



keydown

keypress


keyup




click

dblclick

mousedown

mousemove

mouseout

       

66
mouseover

mouseup




error

resize


$(‟selector‟).event(function);
 function event  
selector


bind

$(„selector‟).bind(„event‟ , function);
67
event
function
jQuery
$(‟img‟).click(myFunction);
$(„img‟).bind(„click‟ , myFunction);
bind


$(„img‟).bind(„click‟,F1).bind(„click‟,F2).bind(„click‟,F
3);
F1F2F3

$(„img‟).click(F1).click(F2).click(F3);
bindunbind
bind
$(„img‟).bind(„click‟,Func1).bind(„click‟,Func2)
.bind(„click‟,Func3);
$(„img‟).unbind(„click‟,Func2);
68
Func3Func1
Func2unbind

jQuerybindone
bind
one

$(„img‟).one(“click , mousemove , dblclick,
myFunction‟);
  myFunction    click
mousemovedblclick
jQuery

evente

e
$(‟a‟).click(function(e){
Alert(“”);
});
e
e
69
click

$(„a‟).click(function (e){
alert(etype);
});
click
typeetypee

java script
jQuery
e
e

e


altKey
truealt
false
ctrlKey
truectrl
false
70
keyCode
keyupkeydown
ASCII
        
upper case
aA
pageX
X


pageY
      Y


screenX
X


screenY
      Y
        

relatedTarget


shiftKey
trueshift
71
false
type

which
        
ASCII


jQuery


preventDefaulte

$(„a‟).click(function(e){
epreventDefault();
};


72
7587

Animations
73
Animations
Microsoft

FlashjQuery


jQueryAnimations

showhide

$(„selector‟).show();
selector

$(„selector‟).hide();
selector
Tree Lists
<html>
<head>
<scriptsrc”jqueryjs” type”textjavascript”>
74
<script>
<scripttypetextjavascript”>
$(document).ready(function(){
$(„lihas(ol)‟).css(„curosr,pointer‟);
$(„lihas(ol)„).click(function(){
If($(this).children().is(„hidden‟))
$(this).children().show();
else
$(this).children().hide();
});
});
<script>
<head>
<bodydirrtl>
<fieldset>
<legend>  <legend>
<ul>
<li><li>
<li>
<ol>
75
<li><li>
<li><li>
<li><li>
<li><li>
<li><li>
<ol>
<li>
<li><li>
<li>
<ol>
<li><li>
<li><li>
 <li><li>
<ol>
<li>
<li><li>
<li><li>
<ul>
76
<fieldset>
<body>
<html>
Unordered listul
orederd list
ol

$(„lihas(ol)‟).css(„curosr,pointer‟);

olhasliliol


$(„lihas(ol)‟).click(function(){
if($(this).children().is(‟hidden‟))
$(this).children().show();
else
$(this).children().hide();
});
77

isjQuery
true
falsechildren

if($(this).children().is(hidden‟))
this
this
jQuery
toggle

$(‟selector‟).toggle();
selector
jQuery

$(„lihas(ol)„).click(function(){
$(this).children().toggle();
});
78
jQuery


showhidetoggle



$(„selector‟).show(speed);
$(„selector‟).hidespeed);
$(„selector‟).togglespeed);
speed
speed
       „slow‟    
„normal‟„fast‟


jQuery

$(„lihas(ol)„).click(function(){
79
$(this).children().toggle(1000);
});

$(„lihas(ol)„).click(function(){
 $(this).children().toggle(„slow‟);
});

jQuery
showhidetoggle

$(‟selector‟).show(speed,F);
$(‟selector‟).hide(speed,F);
$(„selector‟).toggle(speed,F);
F


jQuery
Fade in
80
$(‟selector‟).fadeIn(speed,F);
speed
jQueryslow
normalfast
F
Optional parameter

fade out

$(„selector‟).fadeout(speed,F);
  speed     F  

jQueryfadeTo
opacity
$(‟selector‟).fadeTo(speed,opacity,F);
speedF
opacity

81

fadeTofadeOut

jQuery
slide downslideDown
$(‟selector‟).slideDown(speed,F);
speedF
slide upslideUp

$(‟selector‟).slideUp(speed,F);
speedF

          
slideToggleslide Down
slide Up
$(‟selector‟).slideToggle(speed,F);
speedF

82

jQuerystop

$(‟selector‟).stop();

jQuery



show


hide


toggle


fadeIn


fadeOut


fadeTo


slideDown


slideUp


slideToggle


83
stop


jQuery
animate
$(‟selector‟).animate(properties,speed);
propertiesJSON


propertiesspeed

properties
height
opacitytopfontsize
showtogglehide

fadeToggle


$(‟selector‟).animate({opacity ‟toggle‟}, ‟slow‟);
84
    speed   slow  
propertiesJSON
{opacity ‟toggle‟}
opacity

$(‟selector‟).animate(
{ width  $(this).width() * 3 ,
height $(this).height() * 3 }
, „slow‟ );

JSON
speed
85
87110

AJAX
86
AJAXWeb
WebAJAX
AJAXAsynchronous Java Script And XML
WebServer

Web
jQuery



AJAXAJAX

ServerAJAX



87

     jQuery     
Serverload
$(‟selector‟).load(url,JSON,F);
url
JSON
F

load
SelectorServer
HTML

$(‟#divA‟).load(‟myPageaspx‟);
         divA 
aspxmyPage

HTML

$(‟#divA‟).load(„myPageaspx ahrefwwwawcom);
88
divA
comawwwwhrefa load
aspxmyPage


myPageaspx?p1v1&p2v2

$(‟#divA‟).load(myPageaspx‟, {p1‟v1, p2‟v2‟});
JSON
Internet Explorer
    Cache     


Cache

89

loadForms
         serialize
 aspxmyPage       
myForm
$(‟#divA‟).load(myPageaspx‟, $(‟#myForm‟).serialize());
serializeJSONload
aspxmyPage
 JSON 
POST
GET
GET
jQueryGET
POSTget$
GET

$get(url,JSON,F);
90
url
JSON
F

jQuery
X$
X
get$
$get(
myPagephp‟,
{p1 „10‟ , p2 ‟cat‟},
Function(data){alert(data);}
);

myPagephp?p110&p2cat
data

91
POST
get$post$
POST
$post(url,JSON,F);
urlJSON
F




JSONjQuery
get$   JSON   
getJSON$
$getJSON(url,JSON,F);
urlJSON
F
JSON
92
AJAXjQuery
getScript$java script

$getScript(url,F);
urlJava scriptF

AJAX
jQueryAJAX
AJAX
ajax$
$ajax(options);
optionsJSON
           
ajax$



url



type

GETPOST
93
data
JSON
JSON  

dataType



  XMLJSON
SCRIPTTEXT
timeout

   



success

    

error



complete

    

beforeSend



async

   True

94
   
False
processData

    
  data
Web
     
true
false

$ajax(
{
url myPagejsp‟ ,
type „GET‟ ,
dataType „XML‟
}
);
jQuery
ajax$ajaxSetup$

95
$ajaxSetup(properties);
propertiesJSON
ajax$properties

ajax$
$ajaxSetup(
{
type „GET‟ ,
dataType „XML‟ ,
error function(err){
alert(„erro message is msg);
},
timeout 10000
}
);
AJAX
jQueryAJAX
AJAX
96
Events



ajaxComplete
AJAX
ajaxError
AJAX
ajaxSend
AJAX
ajaxStart
      
AJAX
ajaxStop
AJAX
ajaxSuccess
     AJAX

WebjQuery
AJAX


97


Plugins
98
plugins
jQuery
plugins

comjqueryplugins

Java Script
jQuery



jQuery
Java ScriptWeb







99
nterfaceIjQuery user


Microsoft
Web

tabsscroll barsaccordions
sliders    date pickers  
color pickers


Themes
100
         
comjqueryuiwwwBuild Custom Download
Formjquery
Forms
jQuery


<select>

AJAX
http://www.jquerycompluginsprojectform
jmaxinput
     
Twitter
   

     
 
jQuery

101
http://pluginsjquerycomprojectjMaxInput
ort accessjquery sh

e
xjQuery
AJAX

http://pluginsjquerycomprojectshortaccesskey
jquery corner
Web


  
Round Corner
    


http://wwwmalsupcomjquerycorner
102
beauty tips
     
tooltip

      
     


http://wwwlullabotcomfilesbtbtlatestDEMOindexhtm
l
BOXY



Facebook


http://pluginsjquerycomprojectboxy
103
ajax fancy captcha


Bots jQuery  

     




Bots

http://wwwwebdesignbeachcombeachbarajaxfancy
captchajqueryplugin
104
Gallerific

     


http://wwwtwospycomga
lleriffic




http://pluginsjquerycom

105
plugins




Java Script




js
plugin
jQuery
plugin
jsMukhtarjQuery




(function($){

})(jQuery);
106









(function($){
$F function(Parameters)
{

};
})(jQuery);
FParameters

            

(function($){
107
$fnF function(Parameters)
{

};
})(jQuery);
FParameters




(function($){
$ourMessage function(msg)
{
var mmsgtoString();
alert(m);
};
})(jQuery);

jQuery
108
$ourMessage(„Hello world „);


Arial
(function($){
$fnchangeFontfunction()
{
return thiscss(„fontfamily‟, „Arial‟);
};
})(jQuery);
cssjQuery
return


$(„#Mydiv‟).changeFont().fadeIn();


#Mydiv
109

each
(function($){
$fnchangeFont function(){
return thiseach(function(){
$(this).css(„fontfamily‟ , arial‟);
});
};
})(jQuery);





mokhtar_ss@hotmail.com



110

JQUERY ..........................................................................................
jQuery ..............................
jQuery .........................................
 ........................................ 
jQuery .................................... 
 ..................................... 
SELECTORS................................................................................ 
 ............................................. 
HTML ................................... 
FUNCTIONS .................................................................................... 
Functions ....................................... 
Attributes ....................... 
Styles ................................ 
Inner content .................. 
Wrapping .................................... 
 ................................... 
FORM ELEMENTS ...................... 
111
EVENTS ........................................................................................ 
ANIMATIONS .............................................................................. 
Animations ..................................... 
 ........................................ 
 ......................................... 
 ......................................... 
 .......................................... 
 .................................. 
 ....................................... 
AJAX ................................................................ 
 ..................................... 
 ............................. 
GET ................................... 
POST .................................. 
 ............................ 
AJAX ................................... 
AJAX ................................. 
PLUGINS .................................................................................... 
112
plugins ...................................... 
jQuery user Interface ............................ 
FormjQuery ................................... 
jmaxinput ..................................... 
jQuery short access ............................. 
jQuery corner .................................. 
beauty tips ................................... 
BOXY ......................................... 
AJAX fancy captcha .............................. 
Gallerific .................................... 
 ..................................... 
plugins ............................... 
 ..................................... 
 .................................. 
 .................................. 
 ................................ 
 ............................................. 

Web Technologies
o
HTML5 & CSS3
jQuery
3D Game Studio
F1-Magazine
o
facebook.com/mukhtar.ss